package com.knxhd.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.knxhd.service.AssistantService;

import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.model.language.StreamingLanguageModel;
import lombok.RequiredArgsConstructor;

/**
 * Author: tianluhua tianlh@qdcares.cn
 * Date: 2025-07-12 12:41:21
 * Description: 聊天配置
 */
@RestController
@RequestMapping("/chat")
@RequiredArgsConstructor
public class ChatController {

  private final ChatModel chatModel;

  /**
   * 流式输出
   */
  private final StreamingLanguageModel streamingLanguageModel;

  private final AssistantService assistantService;

  @GetMapping("/completions")
  public String chatCompletions(String question) {

    return chatModel.chat(question);
  }

  @GetMapping(value = "/assistantCompletions")
  public String assistantCompletions(String question) {
    return assistantService.chat(question);
  }

  @GetMapping(value = "/completionsStream")
  public void chatCompletionsStream(String question) {
    
  }
}
